<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>中奖都记录管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/wechat/lotteryRecord/">中奖者记录列表</a></li>
		<shiro:hasPermission name="sys:user:edit"><li><a href="${ctx}/wechat/lotteryRecord/form">中奖记录添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="lotteryRecord" action="${ctx}/wechat/lotteryRecord/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>奖品名称 ：</label><form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
		<label>手机 ：</label><form:input path="member.mobile" htmlEscape="false" maxlength="20" class="input-medium"/>
		<label>状态 ：</label> 
				<form:select path="status" class="input-medium">
					<form:option value="" label="全部"/>
					<form:options items="${selectItems }" itemLabel="value" itemValue="key" htmlEscape="false" />
				</form:select>
		<label>抽奖类型 ：</label> 
				<form:select path="sourceType" class="input-medium">
					<form:option value="" label="全部"/>
					<form:option value="2" label="商家抽奖"/>
					<form:option value="1" label="会员抽奖"/>
					<form:option value="3" label="会员注册送奖品"/>
					<form:option value="7" label="推荐人送奖品"/>
					<form:option value="4" label="赞助奖品"/>
					<form:option value="5" label="广告奖品"/>
					<form:option value="6" label="砸金蛋"/>
				</form:select>
				
				
			<br><br><label class="control-label" style="margin-top:3px;">开始时间:</label>
				
					<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
					<input id="createTime" name="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${lotteryRecord.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>  
<label class="control-label" style="margin-top:3px;">结束时间:</label>
					<input id="endTime" name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${lotteryRecord.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
				
				
				
				
		&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	</form:form>
	<tags:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered ">
		<thead><tr>
		<th>序号</th>
		<shiro:hasPermission name="sys:user:edit"><th>所属商家</th></shiro:hasPermission>
		<th>中奖者</th>
		<th>奖品</th>
		<th>奖品类型</th>
		<th>手机号</th><th>状态</th><th>有效时间</th><th>核销时间</th><shiro:hasPermission name="wechat:lotteryRecord:edit"><th>操作</th></shiro:hasPermission></tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="lotteryRecord" varStatus="s">
			<tr>
				
				<td> ${s.index+1} </td>
				<shiro:hasPermission name="sys:user:edit"><td> ${lotteryRecord.user.name} </td></shiro:hasPermission>
				<td title="${lotteryRecord.qrCode.content }"> ${lotteryRecord.member.name}  <c:if test="${ lotteryRecord.fromSeller ne lotteryRecord.user.name  and  not empty lotteryRecord.fromSeller}"> 来自 <b>${lotteryRecord.fromSeller }</b> </c:if></td>
				<td> ${lotteryRecord.name} </td>
				<td><c:if test="${lotteryRecord.lottery.type eq 1}">会员抽奖</c:if> <c:if test="${lotteryRecord.lottery.type eq 2}">商家抽奖</c:if>  
				<c:if test="${lotteryRecord.sourceType eq 3}">会员注册送礼品</c:if>
				<c:if test="${lotteryRecord.sourceType eq 4}">赞助奖品</c:if>
				<c:if test="${lotteryRecord.sourceType eq 5}">广告奖品</c:if>
				<c:if test="${lotteryRecord.sourceType eq 6}">砸金蛋</c:if>  
				<c:if test="${lotteryRecord.sourceType eq 7}">推荐人送礼品</c:if>
				
				</td>
				<td>${lotteryRecord.member.mobile}</td>
				<td><c:if test="${lotteryRecord.status == 1 }">已使用</c:if> <c:if test="${lotteryRecord.status == 0 }">未使用</c:if><c:if test="${lotteryRecord.status == 2 }">已作废</c:if></td>
				<td>${lotteryRecord.createTime}<br>${lotteryRecord.endTime}</td>
				<td title="${lotteryRecord.remarks}">${lotteryRecord.updateTime}</td>
				
				<shiro:hasPermission name="wechat:lotteryRecord:edit"><td>
					<c:if test="${lotteryRecord.status eq '0' }">
    				<c:if test="${lotteryRecord.valid eq true }"><a class="btn btn-primary" href="${ctx}/wechat/lotteryRecord/update?id=${lotteryRecord.id}&status=1"  onclick="return confirmx('确认要核销该中奖人记录吗？', this.href)">核销</a></c:if>
    				<a  class="btn btn-info" href="${ctx}/wechat/lotteryRecord/update?id=${lotteryRecord.id}&status=2"  onclick="return confirmx('确认要作废该中奖人记录吗？', this.href)">作废</a>
    				<a class="btn btn-warning" href="${ctx}/wechat/lotteryRecord/form?id=${lotteryRecord.id}">修改</a>
					<a class="btn btn-danger" href="${ctx}/wechat/lotteryRecord/delete?id=${lotteryRecord.id}" onclick="return confirmx('确认要删除该中奖者记录吗？', this.href)">删除</a>
    			</c:if>
				<c:if test="${lotteryRecord.status eq '1' }">
    				<a class="btn btn-info" href="${ctx}/wechat/lotteryRecord/update?id=${lotteryRecord.id}&status=2"  onclick="return confirmx('确认要作废该中奖人记录吗？', this.href)">作废</a>
					<a class="btn btn-danger" href="${ctx}/wechat/lotteryRecord/delete?id=${lotteryRecord.id}" onclick="return confirmx('确认要删除该中奖人记录吗？', this.href)">删除</a>
    			</c:if>
					
				</td>
				</shiro:hasPermission>
				
				
				
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>
